// 登录
function login() {
    var user = $('#tele').val();
    var pwd = $('#password').val();
    if (user === '') {
        alert('请输入用户名');
        return;
    }
    if (pwd === '') {
        alert('请输入密码');
        return;
    }

    var d = {
        tele: user,
        password: pwd
    };

    $.ajax({
        url: BASE_URL + '/loginVarify',
        type: "POST",
        async: false,
        data: d,
        dataType: 'json',
        error: function(errorMsg) {
            toast(errorMsg);
        },
        success: function(data) {
            if (data.code === '0') {
                api.openFrame({
                    name: 'user',
                    url: 'main/profile.html',
                    bounces: false,
                    rect: {
                        x: 0,
                        y: 0,
                        w: 'auto',
                        h: $api.getStorage('sh')
                    }
                });
            } else {
                alert(data.msg);
            }
        }
    });
}
